Repository navigation
Keep the kit's C# in Source/*.cs, copied into ParallelKit.ps1 by a build script - #106
Merged
Merged
Conversation
…arallelKit.ps1 The C# in ParallelKit.ps1's three Add-Type blocks now lives in Source/<Type>.cs, one file per block. Build/Update-ParallelKitCSharp.ps1 copies them into the .ps1, which stays committed and stays the release asset: -Check fails if they differ, and -Compile builds each file with the .NET Framework's csc.exe as C# 5 and with the .NET SDK for pwsh's .NET, with warnings as errors and a short list of analyzer rules. The C# itself is unchanged. A new CI job, C#, runs both. Harness section BN checks the copy matches and tests the script's checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a copy of each .cs file Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
About 1,000 lines of C# sat in three
Add-Type -TypeDefinitionhere-strings inParallelKit.ps1. No editor treated them as C#, and nothing compiled them before the kit loaded or reported compiler warnings and analyzer findings, sinceAdd-Typedoesn't show warnings.The C# now lives in
Source/, one file per block, named after the type that guards it:PkConsoleCtrl.cs,PkConsoleQuickEdit.csandPkChildProcessJob.cs.Build/Update-ParallelKitCSharp.ps1copies them into the blocks.ParallelKit.ps1stays committed, self-contained, and the file attached to each release, so nothing changes for users. The C# itself is unchanged: the copy reproducesParallelKit.ps1byte for byte, soTypesVersionstays at 14.The script:
ParallelKit.ps1fromSource/and leaves everything outside the three blocks alone.-Checkexits 1 ifParallelKit.ps1doesn't matchSource/.-Compilebuilds each file on its own, asAdd-Typedoes, twice. First with the .NET Framework'scsc.exeas C# 5, the compilerAdd-Typeuses on Windows PowerShell 5.1; then with the .NET SDK atLangVersion5, for the .NET that pwsh runs on, with a short list of analyzer rules about real faults. Warnings are errors in both.'@(which would end the here-string), and a file that isn't UTF-8.A new CI job, C#, runs
-Check -Compile. It isn't a required check. The required harness checks catch a stale copy anyway: the new harness section BN runs-Check, and tests the update and the refusals on a copy of the kit in%TEMP%.Testing
-AsModule -Section MODULEUpdate-ParallelKitCSharp.ps1 -Check -CompileAfter the review fixes (the last commit, which only touches the build script), section BN and
-Check -Compilewere run again on both versions and passed. The full harness wasn't rerun locally after that commit; CI runs it.-Compilewas also run against copies with one problem each, and failed on every one: a C# 6 feature (interpolated string), an analyzer finding (CA2200,throw e;) and a compiler warning (an unused variable). A copy in a folder with;and%20in its path compiled correctly, and a copy with an invalid UTF-8 byte was refused with a message naming the file.The new C# job hasn't run on a GitHub runner before. Its SDK step targets the .NET that the runner's pwsh uses, so it needs a matching SDK on the image. This pull request's run will show whether one is there.
🤖 Generated with Claude Code